/************************
 Raphel Extention
 ************************/
Raphael.fn.toys = {        
        bar_graph : function(){ 
                return new BarGraph(this);                
        },
        line_graph : function(){
                return new LineGraph(this);                
        },
        pie_graph : function(){
                return new PieGraph(this);
        },
};

/* Set of functions that allow plotting in cartesian space,i.e.
 * where (0,0) is lower left corner.
 * @author: Andriy Drozdyuk
 */
Raphael.fn.local = {
        l2w_x : function(x){
                return x;        
        },
        l2w_y : function(y){
                return this.height - y - 1;
        },
        
        // Draw text at local x,y
        text : function(x, y, txt){        
                return this.text( this.local.l2w_x(x), this.local.l2w_y(y), txt);
        },
        
        // Draw rect at local x and y
        rect : function(x, y, width, height){
                var left_x = this.local.l2w_x(x);
                var bottom_y = this.local.l2w_y(y);
                var right_x = left_x + width;
                var top_y = bottom_y - height;
                var draw_str = ("M" + left_x + " " + bottom_y
                                + "L" + right_x + " " + bottom_y
                                + "L" + right_x + " " + top_y
                                + "L" + left_x + " " + top_y
                                + "L" + left_x + " " + bottom_y
                                );                
                return this.path(draw_str);
        },        
        
        
        
        
};




